package com.hj.demo;

import java.math.BigDecimal;

public class Demo3 {
    public static void main(String[] args) {
        String num = "23.23456789";
        Int anInt = new Int();
        String num1=anInt.handleString(num);
        System.out.println(num1);
        Dou dou = new Dou();
        String num2=dou.handleString(num);
        System.out.println(num2);
    }
}
interface Handleable{
    String handleString(String num);
}
class Int implements Handleable{
    @Override
    public String handleString(String num) {
        BigDecimal bigDecimal = new BigDecimal(num);
        return bigDecimal.divide(BigDecimal.valueOf(1),0,1).toString();
    }
}
class Dou implements Handleable{

    @Override
    public String handleString(String num) {
        BigDecimal bigDecimal = new BigDecimal(num);
        return bigDecimal.divide(BigDecimal.valueOf(1),4,4).toString();
    }
}